/*
 * CongresosForm.java
 *
 * Created on 28 de junio de 2008, 14:50
 */
package View;

import Controller.ABMCongresoController;
import Controller.RPedidoController;
import Model.Caja;
import Model.Congreso;
import Model.Reposicion;
import com.birosoft.liquid.LiquidLookAndFeel;
//import java.awt.event.KeyAdapter;
//import java.awt.event.KeyEvent;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.UIManager;

/**
 *
 * @author  Ernesto
 */
public class CongresosForm extends javax.swing.JFrame {

    private RPedidoController mRPedidoController;
    private PpalForm ppal;
    private ABMCongresoController abmcc;
    Congreso con;
    Congreso oficina;
    Caja caja;

    /** Creates new form CongresosForm */
    public CongresosForm() {
        mRPedidoController = new RPedidoController();
        // Se carga el Look and Feel
        try {
            UIManager.setLookAndFeel("com.birosoft.liquid.LiquidLookAndFeel");
        } catch (Exception e) {
        }
        LiquidLookAndFeel.setStipples(false);
        LiquidLookAndFeel.setShowTableGrids(true);

        initComponents();

        cambiaPanelNuevo(false);
        cambiaPanelModificar(false);
        abmcc = new ABMCongresoController();
        abmcc.cargarCongresos();
        jTextStockAdic.setVisible(false);
        jLabelStockAdic.setVisible(false);
    }

    private void cambiaPanelNuevo(boolean estado) {
        jComboBoxDia.setEnabled(estado);
        jComboBoxMes.setEnabled(estado);
        jComboBoxAnio.setEnabled(estado);
        jComboProvincia.setEnabled(estado);
        jComboDiaFin.setEnabled(estado);
        jComboMesFin.setEnabled(estado);
        jComboAnioFin.setEnabled(estado);
        jTextNombre.setEnabled(estado);
        jTextPrecio.setEnabled(estado);
        jTextSaldo.setEnabled(estado);
        jComboPais.setEnabled(estado);
        jComboPrecio2.setEnabled(estado);
        jComboPrecio3.setEnabled(estado);
        jTextPrecio2.setEnabled(estado);
        jTextPrecio3.setEnabled(estado);
        jComboLocalidad.setEnabled(estado);
        jTextCantidad.setEnabled(estado);
        stock_inicial.setEnabled(estado);
        jTextIniciales.setEnabled(estado);
        jButtonAceptar.setEnabled(estado);
        jTextStockAdic.setVisible(false);
        jLabelStockAdic.setVisible(false);

    }

    private void cambiaPanelModificar(boolean estado) {
        jComboCongresos.setEnabled(estado);
        jButtonDesact.setEnabled(estado);
        jButtonEliminar.setEnabled(estado);
        jLabelTitulo.setVisible(estado);
        jLabelFechaInicio.setVisible(estado);
        jLabelFechaFin.setVisible(estado);
        jLabelCiudad.setVisible(estado);
        jLabel12.setVisible(estado);
        jLabel13.setVisible(estado);
        jLabel14.setVisible(estado);
        Boton_modificar.setEnabled(estado);
        jTextStockAdic.setVisible(true);
        jLabelStockAdic.setVisible(true);
    }

    public void alta() {
        abmcc = new ABMCongresoController();

        abmcc.cargarProvincias();
        abmcc.cargarLocalidades();
        abmcc.cargarPaises();
        abmcc.cargarMonedas();
        //Carga el combo de los Paises.
        abmcc.cargadatosCombo(jComboPais, abmcc.getPaises());
        
        abmcc.cargadatosCombo(jComboPrecio2, abmcc.getMonedas());
        abmcc.cargadatosCombo(jComboPrecio3, abmcc.getMonedas());
        //Carga el combo de las Localidades.
        abmcc.cargadatosCombo(jComboProvincia, abmcc.getProvincias());

        //Carga el combo de las Ciudades
        abmcc.cargadatosCombo(jComboLocalidad, abmcc.getLocalidades());
        abmcc.cargaCombos(jComboPrecio2, abmcc.getMonedas());
        abmcc.cargaCombos(jComboPrecio3, abmcc.getMonedas());
        abmcc.cargaCombos(jComboPais, abmcc.getPaises());
        abmcc.cargaCombos(jComboProvincia, abmcc.getProvincias());
        abmcc.cargaCombos(jComboLocalidad, abmcc.getLocalidades());
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    // @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jComboBoxDia = new javax.swing.JComboBox();
        jComboBoxMes = new javax.swing.JComboBox();
        jComboBoxAnio = new javax.swing.JComboBox();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jComboProvincia = new javax.swing.JComboBox();
        jButtonAceptar = new javax.swing.JButton();
        jLabel5 = new javax.swing.JLabel();
        jComboDiaFin = new javax.swing.JComboBox();
        jComboMesFin = new javax.swing.JComboBox();
        jComboAnioFin = new javax.swing.JComboBox();
        jLabel6 = new javax.swing.JLabel();
        jTextNombre = new javax.swing.JTextField();
        jLabel7 = new javax.swing.JLabel();
        jTextPrecio = new javax.swing.JTextField();
        jLabel8 = new javax.swing.JLabel();
        jComboPais = new javax.swing.JComboBox();
        jLabel9 = new javax.swing.JLabel();
        jComboLocalidad = new javax.swing.JComboBox();
        jLabel10 = new javax.swing.JLabel();
        jTextSaldo = new javax.swing.JTextField();
        jButtonVolver = new javax.swing.JButton();
        jTextCantidad = new javax.swing.JTextField();
        jTextIniciales = new javax.swing.JTextField();
        Boton_modificar = new javax.swing.JButton();
        jLabel17 = new javax.swing.JLabel();
        stock_inicial = new javax.swing.JTextField();
        jLabelStockAdic = new javax.swing.JLabel();
        jTextStockAdic = new javax.swing.JTextField();
        jComboPrecio2 = new javax.swing.JComboBox();
        jLabel18 = new javax.swing.JLabel();
        jTextPrecio2 = new javax.swing.JTextField();
        jLabel19 = new javax.swing.JLabel();
        jComboPrecio3 = new javax.swing.JComboBox();
        jTextPrecio3 = new javax.swing.JTextField();
        jPanelTitulo = new javax.swing.JPanel();
        jComboCongresos = new javax.swing.JComboBox();
        jLabelFechaInicio = new javax.swing.JLabel();
        jLabelTitulo = new javax.swing.JLabel();
        jLabelFechaFin = new javax.swing.JLabel();
        jLabelCiudad = new javax.swing.JLabel();
        jButtonDesact = new javax.swing.JButton();
        jButtonEliminar = new javax.swing.JButton();
        jLabel12 = new javax.swing.JLabel();
        jLabel13 = new javax.swing.JLabel();
        jLabel14 = new javax.swing.JLabel();
        jPanelSeleccion = new javax.swing.JPanel();
        jButtonNuevo = new javax.swing.JButton();
        jButtonModificar = new javax.swing.JButton();
        jLabel11 = new javax.swing.JLabel();
        jLabel15 = new javax.swing.JLabel();
        jLabel16 = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "NUEVO CONGRESO", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Verdana", 1, 12), new java.awt.Color(94, 148, 189))); // NOI18N
        jPanel1.setMaximumSize(new java.awt.Dimension(1400, 400));

        jLabel1.setFont(new java.awt.Font("Verdana", 0, 10)); // NOI18N
        jLabel1.setText("Iniciales: ");

        jLabel2.setFont(new java.awt.Font("Verdana", 0, 10));
        jLabel2.setText("Fecha Inicio:");

        jComboBoxDia.setFont(new java.awt.Font("Verdana", 0, 10)); // NOI18N
        jComboBoxDia.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31" }));

        jComboBoxMes.setFont(new java.awt.Font("Verdana", 0, 10)); // NOI18N
        jComboBoxMes.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12" }));
        jComboBoxMes.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jComboBoxMesActionPerformed(evt);
            }
        });

        jComboBoxAnio.setFont(new java.awt.Font("Verdana", 0, 10)); // NOI18N
        jComboBoxAnio.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "", "2008", "2009", "2010", "2011", "2012", "2013", "2014", "2015", "2016", "2017", "2018", "2019", "2020" }));

        jLabel3.setFont(new java.awt.Font("Verdana", 0, 10)); // NOI18N
        jLabel3.setText("Cantidad DVD:");

        jLabel4.setFont(new java.awt.Font("Verdana", 0, 10)); // NOI18N
        jLabel4.setText("Provincia:");

        jComboProvincia.setEditable(true);
        jComboProvincia.setFont(new java.awt.Font("Verdana", 0, 10)); // NOI18N

        jButtonAceptar.setFont(new java.awt.Font("Verdana", 1, 10));
        jButtonAceptar.setForeground(new java.awt.Color(94, 148, 189));
        jButtonAceptar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Botones/Guardar_normal.gif"))); // NOI18N
        jButtonAceptar.setToolTipText("Guardar los cambios realizados");
        jButtonAceptar.setBorderPainted(false);
        jButtonAceptar.setContentAreaFilled(false);
        jButtonAceptar.setDisabledIcon(new javax.swing.ImageIcon(getClass().getResource("/Botones/Guardar_deshabilitado.gif"))); // NOI18N
        jButtonAceptar.setPressedIcon(new javax.swing.ImageIcon(getClass().getResource("/Botones/Guardar_presionado.gif"))); // NOI18N
        jButtonAceptar.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/Botones/Guardar_mouse.gif"))); // NOI18N
        jButtonAceptar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonAceptarActionPerformed(evt);
            }
        });

        jLabel5.setFont(new java.awt.Font("Verdana", 0, 10)); // NOI18N
        jLabel5.setText("Fecha Fin:");

        jComboDiaFin.setFont(new java.awt.Font("Verdana", 0, 10)); // NOI18N
        jComboDiaFin.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31" }));
        jComboDiaFin.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jComboDiaFinActionPerformed(evt);
            }
        });

        jComboMesFin.setFont(new java.awt.Font("Verdana", 0, 10)); // NOI18N
        jComboMesFin.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12" }));
        jComboMesFin.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jComboMesFinActionPerformed(evt);
            }
        });

        jComboAnioFin.setFont(new java.awt.Font("Verdana", 0, 10)); // NOI18N
        jComboAnioFin.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "", "2008", "2009", "2010", "2011", "2012", "2013", "2014", "2015", "2016", "2017", "2018", "2019", "2020" }));

        jLabel6.setFont(new java.awt.Font("Verdana", 0, 10)); // NOI18N
        jLabel6.setText("Nombre:");

        jTextNombre.setFont(new java.awt.Font("Verdana", 0, 10));
        jTextNombre.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jTextNombreActionPerformed(evt);
            }
        });
        jTextNombre.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                jTextNombreKeyReleased(evt);
            }
        });

        jLabel7.setFont(new java.awt.Font("Verdana", 0, 10)); // NOI18N
        jLabel7.setText("Precio: $");

        jTextPrecio.setFont(new java.awt.Font("Verdana", 0, 10));

        jLabel8.setFont(new java.awt.Font("Verdana", 0, 10)); // NOI18N
        jLabel8.setText("Pais:");

        jComboPais.setEditable(true);
        jComboPais.setFont(new java.awt.Font("Verdana", 0, 10)); // NOI18N

        jLabel9.setFont(new java.awt.Font("Verdana", 0, 10)); // NOI18N
        jLabel9.setText("Ciudad:");

        jComboLocalidad.setEditable(true);
        jComboLocalidad.setFont(new java.awt.Font("Verdana", 0, 10)); // NOI18N

        jLabel10.setFont(new java.awt.Font("Verdana", 0, 10)); // NOI18N
        jLabel10.setText("Saldo Inicial: $");

        jTextSaldo.setFont(new java.awt.Font("Verdana", 0, 10));

        jButtonVolver.setFont(new java.awt.Font("Verdana", 1, 10));
        jButtonVolver.setForeground(new java.awt.Color(94, 148, 189));
        jButtonVolver.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Botones/Volver_normal.gif"))); // NOI18N
        jButtonVolver.setToolTipText("Volver a la pantalla principal");
        jButtonVolver.setBorderPainted(false);
        jButtonVolver.setContentAreaFilled(false);
        jButtonVolver.setDisabledIcon(new javax.swing.ImageIcon(getClass().getResource("/Botones/Volver_deshabilitado.gif"))); // NOI18N
        jButtonVolver.setFocusPainted(false);
        jButtonVolver.setPressedIcon(new javax.swing.ImageIcon(getClass().getResource("/Botones/Volver_presionado.gif"))); // NOI18N
        jButtonVolver.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/Botones/Volver_mouse.gif"))); // NOI18N
        jButtonVolver.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonVolverActionPerformed(evt);
            }
        });

        jTextCantidad.setFont(new java.awt.Font("Verdana", 0, 10));

        jTextIniciales.setFont(new java.awt.Font("Verdana", 0, 10));
        jTextIniciales.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyReleased(java.awt.event.KeyEvent evt) {
                jTextInicialesKeyReleased(evt);
            }
        });

        Boton_modificar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Botones/Modificar_normal.gif"))); // NOI18N
        Boton_modificar.setContentAreaFilled(false);
        Boton_modificar.setDisabledIcon(new javax.swing.ImageIcon(getClass().getResource("/Botones/Modificar_deshabilitado.gif"))); // NOI18N
        Boton_modificar.setFocusPainted(false);
        Boton_modificar.setPressedIcon(new javax.swing.ImageIcon(getClass().getResource("/Botones/Modificar_presionado.gif"))); // NOI18N
        Boton_modificar.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/Botones/Modificar_mouse.gif"))); // NOI18N
        Boton_modificar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                Boton_modificarActionPerformed(evt);
            }
        });

        jLabel17.setText("Stock Inicial:");

        jLabelStockAdic.setText("Stock Adicional:");

        jLabel18.setText("Precio en:");

        jTextPrecio2.setText("0");

        jLabel19.setText("Precio en:");

        jTextPrecio3.setText("0");

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(16, 16, 16)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel5)
                    .addComponent(jLabel18)
                    .addComponent(jLabel6)
                    .addComponent(jLabel2)
                    .addComponent(jLabel4)
                    .addComponent(jLabel8)
                    .addComponent(jLabel9)
                    .addComponent(jLabel1)
                    .addComponent(jLabel3))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(jTextNombre, javax.swing.GroupLayout.PREFERRED_SIZE, 231, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(jPanel1Layout.createSequentialGroup()
                                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jComboPrecio2, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(jTextCantidad, javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                        .addComponent(jComboBoxDia, javax.swing.GroupLayout.Alignment.LEADING, 0, 71, Short.MAX_VALUE)
                                        .addComponent(jComboDiaFin, javax.swing.GroupLayout.PREFERRED_SIZE, 71, javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addComponent(jTextIniciales))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(jPanel1Layout.createSequentialGroup()
                                        .addComponent(jComboMesFin, javax.swing.GroupLayout.PREFERRED_SIZE, 71, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(jComboAnioFin, javax.swing.GroupLayout.PREFERRED_SIZE, 78, javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addGroup(jPanel1Layout.createSequentialGroup()
                                        .addComponent(jComboBoxMes, javax.swing.GroupLayout.PREFERRED_SIZE, 71, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(jComboBoxAnio, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addGroup(jPanel1Layout.createSequentialGroup()
                                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
                                                .addComponent(jLabel17)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                .addComponent(stock_inicial))
                                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
                                                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                                    .addGroup(jPanel1Layout.createSequentialGroup()
                                                        .addGap(12, 12, 12)
                                                        .addComponent(jTextPrecio2, javax.swing.GroupLayout.DEFAULT_SIZE, 33, Short.MAX_VALUE))
                                                    .addComponent(jLabel7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                                    .addComponent(jTextPrecio, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                    .addComponent(jLabel19))))
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addGroup(jPanel1Layout.createSequentialGroup()
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                .addComponent(jLabel10)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                .addComponent(jTextSaldo, javax.swing.GroupLayout.PREFERRED_SIZE, 49, javax.swing.GroupLayout.PREFERRED_SIZE))
                                            .addGroup(jPanel1Layout.createSequentialGroup()
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                .addComponent(jLabelStockAdic)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                .addComponent(jTextStockAdic, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE))
                                            .addGroup(jPanel1Layout.createSequentialGroup()
                                                .addComponent(jComboPrecio3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                .addComponent(jTextPrecio3, javax.swing.GroupLayout.PREFERRED_SIZE, 49, javax.swing.GroupLayout.PREFERRED_SIZE)))
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)))))
                        .addContainerGap(587, Short.MAX_VALUE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jComboLocalidad, javax.swing.GroupLayout.Alignment.LEADING, 0, 343, Short.MAX_VALUE)
                            .addComponent(jComboProvincia, javax.swing.GroupLayout.Alignment.LEADING, 0, 343, Short.MAX_VALUE)
                            .addComponent(jComboPais, javax.swing.GroupLayout.Alignment.LEADING, 0, 343, Short.MAX_VALUE)
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
                                .addGap(5, 5, 5)
                                .addComponent(Boton_modificar, javax.swing.GroupLayout.PREFERRED_SIZE, 127, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 88, Short.MAX_VALUE)
                                .addComponent(jButtonAceptar, javax.swing.GroupLayout.PREFERRED_SIZE, 123, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGap(151, 151, 151)
                        .addComponent(jButtonVolver, javax.swing.GroupLayout.PREFERRED_SIZE, 129, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(356, 356, 356))))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(22, 22, 22)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jTextNombre, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel6))
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jTextIniciales, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel1)
                    .addComponent(jLabel17)
                    .addComponent(stock_inicial, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabelStockAdic)
                    .addComponent(jTextStockAdic, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jTextCantidad, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel3)
                    .addComponent(jLabel7)
                    .addComponent(jTextPrecio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel10)
                    .addComponent(jTextSaldo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(2, 2, 2)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel18)
                    .addComponent(jLabel19)
                    .addComponent(jTextPrecio3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jComboPrecio2, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jComboPrecio3, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jTextPrecio2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jComboBoxDia, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jComboBoxMes, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jComboBoxAnio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel2))
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jComboDiaFin, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jComboMesFin, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jComboAnioFin, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel5))
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jComboPais, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel8))
                .addGap(11, 11, 11)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jComboProvincia, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel4))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jComboLocalidad, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel9))
                .addGap(18, 18, 18)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jButtonVolver, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(Boton_modificar, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jButtonAceptar, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(21, Short.MAX_VALUE))
        );

        jPanelTitulo.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "MODIFICAR CONGRESO", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Verdana", 1, 12), new java.awt.Color(94, 148, 189))); // NOI18N

        jComboCongresos.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jComboCongresosActionPerformed(evt);
            }
        });

        jLabelFechaInicio.setFont(new java.awt.Font("Verdana", 0, 10));

        jLabelTitulo.setFont(new java.awt.Font("Monotype Corsiva", 1, 24));
        jLabelTitulo.setForeground(new java.awt.Color(94, 148, 189));
        jLabelTitulo.setText("Seleccionar un congreso para comenzar");

        jLabelFechaFin.setFont(new java.awt.Font("Verdana", 0, 10));

        jLabelCiudad.setFont(new java.awt.Font("Verdana", 0, 10));

        jButtonDesact.setFont(new java.awt.Font("Verdana", 1, 10));
        jButtonDesact.setForeground(new java.awt.Color(94, 148, 189));
        jButtonDesact.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Botones/Desactivar_normal.gif"))); // NOI18N
        jButtonDesact.setToolTipText("Desactivar el congreso");
        jButtonDesact.setBorderPainted(false);
        jButtonDesact.setContentAreaFilled(false);
        jButtonDesact.setDisabledIcon(new javax.swing.ImageIcon(getClass().getResource("/Botones/Desactivar_deshabilitado.gif"))); // NOI18N
        jButtonDesact.setPressedIcon(new javax.swing.ImageIcon(getClass().getResource("/Botones/Desactivar_presionado.gif"))); // NOI18N
        jButtonDesact.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/Botones/Desactivar_mouse.gif"))); // NOI18N
        jButtonDesact.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonDesactActionPerformed(evt);
            }
        });

        jButtonEliminar.setFont(new java.awt.Font("Verdana", 1, 10));
        jButtonEliminar.setForeground(new java.awt.Color(94, 148, 189));
        jButtonEliminar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Botones/Eliminar_normal.gif"))); // NOI18N
        jButtonEliminar.setToolTipText("Eliminar para siempre el congreso");
        jButtonEliminar.setBorderPainted(false);
        jButtonEliminar.setContentAreaFilled(false);
        jButtonEliminar.setDisabledIcon(new javax.swing.ImageIcon(getClass().getResource("/Botones/Eliminar_deshabilitado.gif"))); // NOI18N
        jButtonEliminar.setPressedIcon(new javax.swing.ImageIcon(getClass().getResource("/Botones/Eliminar_presionado.gif"))); // NOI18N
        jButtonEliminar.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/Botones/Eliminar_mouse.gif"))); // NOI18N
        jButtonEliminar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonEliminarActionPerformed(evt);
            }
        });

        jLabel12.setFont(new java.awt.Font("Verdana", 1, 10));
        jLabel12.setForeground(new java.awt.Color(94, 148, 189));
        jLabel12.setText("Fecha Inicio:");

        jLabel13.setFont(new java.awt.Font("Verdana", 1, 10));
        jLabel13.setForeground(new java.awt.Color(94, 148, 189));
        jLabel13.setText("Fecha Fin:");

        jLabel14.setFont(new java.awt.Font("Verdana", 1, 10));
        jLabel14.setForeground(new java.awt.Color(94, 148, 189));
        jLabel14.setText("Ciudad:");

        javax.swing.GroupLayout jPanelTituloLayout = new javax.swing.GroupLayout(jPanelTitulo);
        jPanelTitulo.setLayout(jPanelTituloLayout);
        jPanelTituloLayout.setHorizontalGroup(
            jPanelTituloLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelTituloLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanelTituloLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jComboCongresos, javax.swing.GroupLayout.PREFERRED_SIZE, 305, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(jPanelTituloLayout.createSequentialGroup()
                        .addComponent(jButtonDesact, javax.swing.GroupLayout.PREFERRED_SIZE, 129, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jButtonEliminar, javax.swing.GroupLayout.PREFERRED_SIZE, 127, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(28, 28, 28)
                .addGroup(jPanelTituloLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabelTitulo, javax.swing.GroupLayout.PREFERRED_SIZE, 371, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(jPanelTituloLayout.createSequentialGroup()
                        .addComponent(jLabel12)
                        .addGroup(jPanelTituloLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanelTituloLayout.createSequentialGroup()
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabelFechaInicio))
                            .addGroup(jPanelTituloLayout.createSequentialGroup()
                                .addGap(99, 99, 99)
                                .addComponent(jLabel13)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabelFechaFin)))
                        .addGap(60, 60, 60)
                        .addComponent(jLabel14)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabelCiudad)))
                .addContainerGap(541, Short.MAX_VALUE))
        );
        jPanelTituloLayout.setVerticalGroup(
            jPanelTituloLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelTituloLayout.createSequentialGroup()
                .addGroup(jPanelTituloLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanelTituloLayout.createSequentialGroup()
                        .addGap(11, 11, 11)
                        .addComponent(jComboCongresos, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanelTituloLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jButtonDesact, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jButtonEliminar, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(jPanelTituloLayout.createSequentialGroup()
                        .addComponent(jLabelTitulo)
                        .addGap(26, 26, 26)
                        .addGroup(jPanelTituloLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabelFechaInicio)
                            .addComponent(jLabel12)
                            .addComponent(jLabelCiudad)
                            .addComponent(jLabel14)
                            .addComponent(jLabelFechaFin)
                            .addComponent(jLabel13))))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jButtonNuevo.setFont(new java.awt.Font("Verdana", 1, 10)); // NOI18N
        jButtonNuevo.setForeground(new java.awt.Color(94, 148, 189));
        jButtonNuevo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Botones/Nuevo_normal.gif"))); // NOI18N
        jButtonNuevo.setToolTipText("Crear un nuevo congreso");
        jButtonNuevo.setBorderPainted(false);
        jButtonNuevo.setContentAreaFilled(false);
        jButtonNuevo.setDisabledIcon(new javax.swing.ImageIcon(getClass().getResource("/Botones/Nuevo_deshabilitado.gif"))); // NOI18N
        jButtonNuevo.setPressedIcon(new javax.swing.ImageIcon(getClass().getResource("/Botones/Nuevo_presionado.gif"))); // NOI18N
        jButtonNuevo.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/Botones/Nuevo_mouse.gif"))); // NOI18N
        jButtonNuevo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonNuevoActionPerformed(evt);
            }
        });

        jButtonModificar.setFont(new java.awt.Font("Verdana", 1, 10)); // NOI18N
        jButtonModificar.setForeground(new java.awt.Color(94, 148, 189));
        jButtonModificar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Botones/Modificar_normal.gif"))); // NOI18N
        jButtonModificar.setToolTipText("Modificar estado de un congreso");
        jButtonModificar.setBorderPainted(false);
        jButtonModificar.setContentAreaFilled(false);
        jButtonModificar.setDisabledIcon(new javax.swing.ImageIcon(getClass().getResource("/Botones/Modificar_deshabilitado.gif"))); // NOI18N
        jButtonModificar.setFocusPainted(false);
        jButtonModificar.setPressedIcon(new javax.swing.ImageIcon(getClass().getResource("/Botones/Modificar_presionado.gif"))); // NOI18N
        jButtonModificar.setRolloverIcon(new javax.swing.ImageIcon(getClass().getResource("/Botones/Modificar_mouse.gif"))); // NOI18N
        jButtonModificar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonModificarActionPerformed(evt);
            }
        });

        jLabel11.setFont(new java.awt.Font("Monotype Corsiva", 1, 24));
        jLabel11.setForeground(new java.awt.Color(94, 148, 189));
        jLabel11.setText("Seleccionar una opción:");

        jLabel15.setFont(new java.awt.Font("Monotype Corsiva", 1, 24)); // NOI18N
        jLabel15.setForeground(new java.awt.Color(94, 148, 189));
        jLabel15.setText("   CONGRESO");

        jLabel16.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Botones/logo_GTV4.gif"))); // NOI18N

        javax.swing.GroupLayout jPanelSeleccionLayout = new javax.swing.GroupLayout(jPanelSeleccion);
        jPanelSeleccion.setLayout(jPanelSeleccionLayout);
        jPanelSeleccionLayout.setHorizontalGroup(
            jPanelSeleccionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanelSeleccionLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel16)
                .addGroup(jPanelSeleccionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanelSeleccionLayout.createSequentialGroup()
                        .addGap(99, 99, 99)
                        .addComponent(jLabel11))
                    .addGroup(jPanelSeleccionLayout.createSequentialGroup()
                        .addGap(18, 18, 18)
                        .addComponent(jLabel15)
                        .addGap(47, 47, 47)
                        .addGroup(jPanelSeleccionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jButtonModificar, javax.swing.GroupLayout.PREFERRED_SIZE, 124, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jButtonNuevo, javax.swing.GroupLayout.PREFERRED_SIZE, 126, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addContainerGap(591, Short.MAX_VALUE))
        );
        jPanelSeleccionLayout.setVerticalGroup(
            jPanelSeleccionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanelSeleccionLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanelSeleccionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel16)
                    .addGroup(jPanelSeleccionLayout.createSequentialGroup()
                        .addComponent(jLabel11)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanelSeleccionLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel15)
                            .addGroup(jPanelSeleccionLayout.createSequentialGroup()
                                .addComponent(jButtonNuevo, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jButtonModificar, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)))))
                .addGap(39, 39, 39))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanelSeleccion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jPanelTitulo, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jPanelSeleccion, javax.swing.GroupLayout.PREFERRED_SIZE, 129, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanelTitulo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(179, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

private void jButtonAceptarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonAceptarActionPerformed
    boolean resultado;
    String fechaInicio, fechaFin;
    fechaInicio = jComboBoxAnio.getSelectedItem() + "-" + jComboBoxMes.getSelectedItem() +
            "-" + jComboBoxDia.getSelectedItem() + " " + "00:00:00";
    fechaFin = jComboAnioFin.getSelectedItem() + "-" + jComboMesFin.getSelectedItem() +
            "-" + jComboDiaFin.getSelectedItem() + " " + "23:59:00";
    try {
        if (abmcc.esCantidadDVD(jTextCantidad.getText()) && abmcc.esPrecio(stock_inicial.getText()) && abmcc.esPrecio(jTextPrecio.getText()) && abmcc.esSaldo(jTextSaldo.getText()) && abmcc.validarFechas(fechaInicio, fechaFin) && abmcc.validarPais(jComboPais.getSelectedItem().toString()) && abmcc.validarProvincia(jComboProvincia.getSelectedItem().toString()) && abmcc.validarLocalidad(jComboLocalidad.getSelectedItem().toString()) && abmcc.esNombre(jTextNombre.getText().toString()) && abmcc.esInicial(jTextIniciales.getText().toString())) {

            oficina = new Congreso();
            oficina = (Congreso)abmcc.getOficina();
            
            con = new Congreso();
            caja = new Caja();
            
            if (Integer.parseInt(stock_inicial.getText()) <= oficina.getStockDvd()){
		    
		    con.setCantDvd(Integer.parseInt(jTextCantidad.getText()));
		    con.setStockDvd(Integer.parseInt(stock_inicial.getText()));
		    con.setIniciales(jTextIniciales.getText());
		    con.setFechaInicio(fechaInicio);
		    con.setFechaFin(fechaFin);
		    con.setEstado("Activo");
		    con.setNombreCong(jTextNombre.getText());
		    con.setPrecioDvd(Float.parseFloat(jTextPrecio.getText()));
		    con.setPais(jComboPais.getSelectedItem().toString());
		    con.setProvincia(jComboProvincia.getSelectedItem().toString());
		    con.setLocalidad(jComboLocalidad.getSelectedItem().toString());
		    caja.setSaldoInicial(Float.parseFloat(jTextSaldo.getText()));
                    con.setSimbM1("AR$");
                    con.setPrecioDvdM2(Float.parseFloat(jTextPrecio2.getText()));
                    con.setPrecioDvdM3(Float.parseFloat(jTextPrecio3.getText()));
                    con.setSimbM2(jComboPrecio2.getSelectedItem().toString());
                    con.setSimbM3(jComboPrecio3.getSelectedItem().toString());
		    con.setCaja(caja);
		    resultado = abmcc.ingresarCongreso(con);
            }else{
                JOptionPane.showMessageDialog(new JFrame(), "El Stock en la oficina no es suficiente", " ", JOptionPane.INFORMATION_MESSAGE);
                resultado = false;
            }
            if (resultado == true) {
                oficina.setStockDvd(oficina.getStockDvd() - Integer.parseInt(stock_inicial.getText()));
		abmcc.modificarCongreso(oficina);
                JOptionPane.showMessageDialog(new JFrame(), "Congreso creado correctamente", " ", JOptionPane.INFORMATION_MESSAGE);
                deshabilitarComponentes();
                limpiarDatos();
            } else {
                JOptionPane.showMessageDialog(new JFrame(), "Error, el congreso ya existe", " ", JOptionPane.INFORMATION_MESSAGE);
            }
        }
    } catch (Exception e) {
        JOptionPane.showMessageDialog(new JFrame(), "Error, Debe ingresar todos los datos", " ", JOptionPane.INFORMATION_MESSAGE);
    }
    
    jButtonModificar.setEnabled(true);
    jButtonNuevo.setEnabled(true);


}//GEN-LAST:event_jButtonAceptarActionPerformed

    public void deshabilitarComponentes() {
        jTextCantidad.setEnabled(false);
        stock_inicial.setEnabled(false);
        jTextIniciales.setEnabled(false);
        jTextNombre.setEnabled(false);
        jTextPrecio.setEnabled(false);
        jComboPais.setEnabled(false);
        jComboPrecio2.setEnabled(false);
        jComboPrecio3.setEnabled(false);
        jTextPrecio2.setEnabled(false);
        jTextPrecio3.setEnabled(false);
        jComboProvincia.setEnabled(false);
        jComboLocalidad.setEnabled(false);
        jTextSaldo.setEnabled(false);
        jComboBoxAnio.setEnabled(false);
        jComboBoxMes.setEnabled(false);
        jComboBoxDia.setEnabled(false);
        jComboAnioFin.setEnabled(false);
        jComboMesFin.setEnabled(false);
        jComboDiaFin.setEnabled(false);
        jButtonAceptar.setEnabled(false);
    }

    private void limpiarDatos() {
        jTextCantidad.setText("");
        stock_inicial.setText("");
        jTextIniciales.setText("");
        jTextNombre.setText("");
        jTextPrecio.setText("");
        jTextSaldo.setText("");
        jComboPais.setSelectedItem("");
        jComboPrecio2.setSelectedItem("");
        jComboPrecio3.setSelectedItem("");
        jComboProvincia.setSelectedItem("");
        jComboLocalidad.setSelectedItem("");
        jComboAnioFin.setSelectedItem("");
        jComboMesFin.setSelectedItem("");
        jComboDiaFin.setSelectedItem("");
        jComboBoxAnio.setSelectedItem("");
        jComboBoxMes.setSelectedItem("");
        jComboBoxDia.setSelectedItem("");       
      //  cargaComboFechas();


    }

    
private void jButtonVolverActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonVolverActionPerformed
    ppal.cargarFormulario();
    this.dispose();

}//GEN-LAST:event_jButtonVolverActionPerformed

private void jComboMesFinActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboMesFinActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jComboMesFinActionPerformed

private void jComboBoxMesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxMesActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jComboBoxMesActionPerformed

private void jComboDiaFinActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboDiaFinActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jComboDiaFinActionPerformed

private void jComboCongresosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboCongresosActionPerformed
//Se guarda el congreso seleccionado en el controller

    con = new Congreso();
    con = (Congreso) jComboCongresos.getSelectedItem();
    //mRPedidoController.setCongreso(mCongreso);

   try{
    // Se muestran datos del congreso seleccionado en la pantalla
    String diai = con.getFechaInicio().substring(8, 10);
    String mesi = con.getFechaInicio().substring(5, 7);
    String anioi = con.getFechaInicio().substring(0, 4);

    String diaf = con.getFechaFin().substring(8, 10);
    String mesf = con.getFechaFin().substring(5, 7);
    String aniof = con.getFechaFin().substring(0, 4);

    String inicio = diai + "/" + mesi + "/" + anioi;
    String fin = diaf + "/" + mesf + "/" + aniof;



    jLabelTitulo.setText(con.getNombreCong());
    jLabelFechaInicio.setText(inicio);
    jLabelFechaFin.setText(fin);
    jLabelCiudad.setText(con.getLocalidad());
    
    this.jTextCantidad.setText(String.valueOf(con.getCantDvd()));
    this.jTextIniciales.setText(con.getIniciales());
    this.stock_inicial.setText(String.valueOf(con.getStockDvd()));
    this.jTextNombre.setText(con.getNombreCong());
    this.jTextPrecio.setText(String.valueOf(con.getPrecioDvd()));
    this.jComboAnioFin.setSelectedItem(aniof);
    this.jComboMesFin.setSelectedItem(mesf);
    this.jComboDiaFin.setSelectedItem(diaf);
    this.jComboBoxAnio.setSelectedItem(anioi);
    this.jComboBoxMes.setSelectedItem(mesi);
    this.jComboBoxDia.setSelectedItem(diai);
    this.jComboPais.setSelectedItem(con.getPais());
    this.jComboPrecio2.setSelectedItem(con.getSimbM2());
    this.jComboPrecio3.setSelectedItem(con.getSimbM3());
    this.jTextPrecio2.setText(String.valueOf(con.getPrecioDvdM2()));
    this.jTextPrecio3.setText(String.valueOf(con.getPrecioDvdM3()));
    this.jComboProvincia.setSelectedItem(con.getProvincia());
    this.jComboLocalidad.setSelectedItem(con.getLocalidad());
    
   }catch (Exception e){}
}//GEN-LAST:event_jComboCongresosActionPerformed

private void jButtonDesactActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonDesactActionPerformed
    Object[] opciones ={"Si","No"};
    int selec = JOptionPane.showOptionDialog(new JFrame(), "Esta seguro que desea desactivar el congreso?","Atención!",JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE,null, opciones, null);
    if(selec == 0){    
        jButtonModificar.setEnabled(true);
        jButtonNuevo.setEnabled(true);
        con.setEstado("Inactivo");
        JOptionPane.showMessageDialog(new JFrame(), "Congreso desactivado correctamente", "Atención!",JOptionPane.INFORMATION_MESSAGE);
        modificarCongreso();
        cambiaPanelModificar(false);
    }
    
}//GEN-LAST:event_jButtonDesactActionPerformed

private void jButtonEliminarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonEliminarActionPerformed
    Object[] opciones ={"Si","No"};
    
    
        try{
          int selec = JOptionPane.showOptionDialog(new JFrame(), "¿Está seguro de eliminar el congreso?","Atención!",JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE,null, opciones, null);
          if(selec == 0){
               jButtonModificar.setEnabled(true);
                jButtonNuevo.setEnabled(true);
                con.setEstado("Eliminado");
                JOptionPane.showMessageDialog(new JFrame(),"Congreso eliminado correctamente", "Atención!",JOptionPane.INFORMATION_MESSAGE);
                modificarCongreso();
                cambiaPanelModificar(false);
          }else
              this.dispose();
                 
        } catch(Exception e){
            JOptionPane.showMessageDialog(new JFrame(), "El congreso no pudo eliminarse"," ", JOptionPane.INFORMATION_MESSAGE);
        }
     
}//GEN-LAST:event_jButtonEliminarActionPerformed

    /** Eliminar o desactivar un congreso */
    private void modificarCongreso() {
        
        abmcc.modificarCongreso(con);
        
        jComboCongresos.setEnabled(false);
        jButtonAceptar.setEnabled(false);
        jButtonDesact.setEnabled(false);
        jButtonEliminar.setEnabled(false);
        jButtonModificar.setEnabled(true);
        jButtonNuevo.setEnabled(true);

    }

private void jButtonNuevoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonNuevoActionPerformed
    cambiaPanelNuevo(true);
    alta();
    jButtonNuevo.setEnabled(false);
    jButtonModificar.setEnabled(true);
    cambiaPanelModificar(false);
    jTextNombre.grabFocus();
    jTextNombre.setCaretPosition(0);
    this.limpiarDatos();
    jTextStockAdic.setVisible(false);
    jLabelStockAdic.setVisible(false);

}//GEN-LAST:event_jButtonNuevoActionPerformed

private void jButtonModificarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonModificarActionPerformed
    cargarComboCongresos();
    if (abmcc.getCongresos().size() > 0){ 
        cambiaPanelModificar(true);
        cargarComboCongresos();
        deshabilitarComponentes();
        limpiarDatos();
        jButtonNuevo.setEnabled(true);
        jButtonModificar.setEnabled(false);
        Boton_modificar.setEnabled(true);
        jComboDiaFin.setEnabled(true);
        jComboMesFin.setEnabled(true);
        jComboAnioFin.setEnabled(true);
        jTextCantidad.setEnabled(true);
        stock_inicial.setEnabled(false);
        jTextNombre.setEnabled(true);
        jTextStockAdic.setVisible(true);
        jLabelStockAdic.setVisible(true);
  }else
        JOptionPane.showMessageDialog(new JFrame(), "No hay congresos cargados en el sistema"," ", JOptionPane.INFORMATION_MESSAGE);
    
     
}//GEN-LAST:event_jButtonModificarActionPerformed

private void jTextInicialesKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextInicialesKeyReleased
    if (jTextIniciales.getText().length() > 10) {
        JOptionPane.showMessageDialog(new JFrame(), "La longitud máxima de las iniciales es de 10 caracteres", " ", JOptionPane.INFORMATION_MESSAGE);
        jTextIniciales.setText(jTextIniciales.getText().substring(0, 10));
    }


}//GEN-LAST:event_jTextInicialesKeyReleased

private void jTextNombreKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextNombreKeyReleased

    if (jTextNombre.getText().length() > 100) {
        JOptionPane.showMessageDialog(new JFrame(), "La longitud máxima del nombre es de 100 caracteres", " ", JOptionPane.INFORMATION_MESSAGE);
        jTextNombre.setText(jTextNombre.getText().substring(0, 100));
    }
}//GEN-LAST:event_jTextNombreKeyReleased

private void jTextNombreActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jTextNombreActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_jTextNombreActionPerformed

private void Boton_modificarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_Boton_modificarActionPerformed
Object[] opciones ={"Si","No"};
    String fechaInicio, fechaFin;
    fechaInicio = jComboBoxAnio.getSelectedItem() + "-" + jComboBoxMes.getSelectedItem() +
            "-" + jComboBoxDia.getSelectedItem() + " " + "00:00:00";
    fechaFin = jComboAnioFin.getSelectedItem() + "-" + jComboMesFin.getSelectedItem() +
            "-" + jComboDiaFin.getSelectedItem() + " " + "23:59:00";
    
        try{
          int selec = JOptionPane.showOptionDialog(new JFrame(), "¿Está seguro de cambiar datos del congreso?","Atención!",JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE,null, opciones, null);
          if(selec == 0){
               jButtonModificar.setEnabled(true);
                jButtonNuevo.setEnabled(true);
                con.setNombreCong(jTextNombre.getText());
                con.setCantDvd(Integer.parseInt(jTextCantidad.getText()));
                if (abmcc.esPrecio(jTextStockAdic.getText())){
                    con.setStockDvd(Integer.parseInt(stock_inicial.getText()) + Integer.parseInt(jTextStockAdic.getText()));
                    //Aca hay que agregar un valor nuevo a congresoXReposicion. que lo agruege magoya no? jaja
                    Reposicion rep= new Reposicion(Integer.parseInt(jTextStockAdic.getText()),'r');
                    rep.setCongreso(con);
                    abmcc.almacenarReposicion(rep);
                }else{
                con.setStockDvd(Integer.parseInt(stock_inicial.getText()));
                }
                con.setFechaInicio(fechaInicio);
                con.setFechaFin(fechaFin);
                JOptionPane.showMessageDialog(new JFrame(),"Congreso modificado correctamente", "Atención!",JOptionPane.INFORMATION_MESSAGE);
                modificarCongreso();
                cambiaPanelModificar(false);
          }else
              this.dispose();
                 
        } catch(Exception e){
            JOptionPane.showMessageDialog(new JFrame(), "El congreso no pudo cambiarse"," ", JOptionPane.INFORMATION_MESSAGE);
        }
   
}//GEN-LAST:event_Boton_modificarActionPerformed

    public void cargarComboCongresos() {
        jComboCongresos.removeAllItems();
         abmcc.cargarCongresos();
        for (int i = 0; i < abmcc.getCongresos().size(); i++) {
            jComboCongresos.addItem(abmcc.getCongresos().get(i));
        }
    }

    public void vaciarComboCongresos() {
        jComboCongresos.removeAllItems();


    }

    public void setPpal(PpalForm p) {
        this.ppal = p;
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton Boton_modificar;
    private javax.swing.JButton jButtonAceptar;
    private javax.swing.JButton jButtonDesact;
    private javax.swing.JButton jButtonEliminar;
    private javax.swing.JButton jButtonModificar;
    private javax.swing.JButton jButtonNuevo;
    private javax.swing.JButton jButtonVolver;
    private javax.swing.JComboBox jComboAnioFin;
    private javax.swing.JComboBox jComboBoxAnio;
    private javax.swing.JComboBox jComboBoxDia;
    private javax.swing.JComboBox jComboBoxMes;
    private javax.swing.JComboBox jComboCongresos;
    private javax.swing.JComboBox jComboDiaFin;
    private javax.swing.JComboBox jComboLocalidad;
    private javax.swing.JComboBox jComboMesFin;
    private javax.swing.JComboBox jComboPais;
    private javax.swing.JComboBox jComboPrecio2;
    private javax.swing.JComboBox jComboPrecio3;
    private javax.swing.JComboBox jComboProvincia;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JLabel jLabelCiudad;
    private javax.swing.JLabel jLabelFechaFin;
    private javax.swing.JLabel jLabelFechaInicio;
    private javax.swing.JLabel jLabelStockAdic;
    private javax.swing.JLabel jLabelTitulo;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanelSeleccion;
    private javax.swing.JPanel jPanelTitulo;
    private javax.swing.JTextField jTextCantidad;
    private javax.swing.JTextField jTextIniciales;
    private javax.swing.JTextField jTextNombre;
    private javax.swing.JTextField jTextPrecio;
    private javax.swing.JTextField jTextPrecio2;
    private javax.swing.JTextField jTextPrecio3;
    private javax.swing.JTextField jTextSaldo;
    private javax.swing.JTextField jTextStockAdic;
    private javax.swing.JTextField stock_inicial;
    // End of variables declaration//GEN-END:variables
}
